/*
 * @Author: WangLi
 * @Date: 2021-07-23 13:47:09
 * @LastEditors: WangLi
 * @LastEditTime: 2021-08-21 11:09:12
 * @Description:
 */
const path = "../radio/index";
Component({
  behaviors: ["wx://form-field"],
  externalClasses: ["custom-class"],
  options: {
    multipleSlots: true,
    addGlobalClass: true,
  },
  relations: {
    [path]: {
      type: "descendant",
    },
  },
  properties: {
    value: {
      type: null,
      observer: "updateChildren",
    },
    direction: String,
    disabled: {
      type: Boolean,
      observer: "updateChildren",
    },
  },
  created() {
    Object.defineProperty(this, "children", {
      get: () => this.getRelationNodes(path) || [],
    });
  },
  methods: {
    updateChildren() {
      this.children.forEach((child) => child.updateFromParent());
    },
  },
});
